<?php 
    global $curUser;
    if($_POST['commit'] == "Delete my account"){
        User::deleteUser($_SESSION['userid']);
        $_SESSION['userid'] = null;
        $curUser = null;
        echo '<script>parent.window.location.reload(true);</script>';
    }
?>
<div id="main" class="site">
  <h2 class="section"><?php if($_SESSION['userid']) echo "Before you go..."; else echo "Good luck to you :)";?></h2>
  <div class="notice success" style="width: 562px;padding-left: 0px; <?php if($_SESSION['userid']) echo "display: none;"; else echo "display: inherit;";?>">
    <h2 style="width: 100%;">Your account deleted. Thanks!</h2>
  </div>
  <ul style="<?php if($_SESSION['userid']) echo "display: inherit;"; else echo "display: none;";?>">
    <li>If you want to change your username, you can <a href="<?php echo $this->baseUrl; ?>Account">do that here</a>.</li>
    <li>Account deletion is <strong>final</strong>. There will be no way to restore your account.</li>
  </ul>
<form style="<?php if($_SESSION['userid']) echo "display: onherit;"; else echo "display: none;";?>" accept-charset="UTF-8" class="group" action="<?php $this->baseUrl ?>DestroyConfirm" enctype="multipart/form-data" id="avatar-form" method="post">  
    <a href="<?php echo $this->baseUrl; ?>Account" class="form-sub">Never mind, I'll keep playing!</a>
    <input alt="Delete" class="form-btn" id="cancel-avatar" name="commit" style="display: inline;" type="submit" value="Delete my account">
</form>
</div>
